import rclpy
from rclpy.node import Node
from geometry_msgs.msg import PointStamped
class PointTFBroadcastPyNode(Node):
    def __init__(self):
        super().__init__('point_tf_broadcast_py_node')
        self.get_logger().info('PointTFBroadcastCppNode创建')
        self.x_=0.0;
        self.point_pub=self.create_publisher(PointStamped,"point",10)
        self.timer=self.create_timer(1.0,self.on_timer);
        
    def on_timer(self):
        ps= PointStamped()
        ps.header.stamp=self.get_clock().now().to_msg()
        ps.header.frame_id="laser"
        self.x_=self.x_+0.01
        ps.point.x =self.x_; 
        ps.point.y = 0.0;
        ps.point.z = -0.1;
        self.point_pub.publish(ps)
        pass
def main():
    rclpy.init()
    rclpy.spin(PointTFBroadcastPyNode())
    rclpy.shutdown()


if __name__ == '__main__':
    main()